package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-15
 */
@Api(tags = "点赞记录表")
@RestController
@RequiredArgsConstructor
@RequestMapping("/likes")
public class LikedRecordController {
    private  final ILikedRecordService likedRecordService;

    /**
     * 点赞或者取消接口
     * @param likeRecordFormDTO
     */
    @PostMapping
    @ApiOperation("点赞或者取消点赞")
    public void likeOrCancel(@RequestBody LikeRecordFormDTO likeRecordFormDTO) {
        likedRecordService.likeOrCancel(likeRecordFormDTO);
    }

    /**
     * 批量查询点赞状态
     */
    @GetMapping("list")
    @ApiOperation("根据业务ID集合查询点赞状态")
    public Set<Long> isLiked(@RequestParam("bizIds") List<Long> bizIds){
        return likedRecordService.isLiked(bizIds);
    }

}
